package starblaze 
{
  import starblaze.error.DuplicateConstantError;
	
  public final class ConstantRegistrar 
  {
    
    internal var m_registry:Vector.<Constant> = new Vector.<Constant>();
    
    private var m_numBytes:uint = 0;
    public function get numBytes():uint { return m_numBytes; }
    
    public function register(constant:Constant):void
    {
      for each (var c:Constant in m_registry)
        if (c.name == constant.name)
          throw new DuplicateConstantError(constant);
          
      m_registry.push(constant);
      m_numBytes += constant.type.numBytes;
    }
    
  }

}
